//----------------------------------------------------------------------------
//  ,-.
// /_\___ ,   Ninja Framework
// '  ___\    (C) Riccardo Capra - http://riccar.do
//  //   \\
//----------------------------------------------------------------------------
//  This program is free software: you can redistribute it and/or modify
//  it under the terms of the GNU General Public License as published by
//  the Free Software Foundation, either version 3 of the License, or
//  (at your option) any later version.
//
//  This program is distributed in the hope that it will be useful,
//  but WITHOUT ANY WARRANTY; without even the implied warranty of
//  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
//  GNU General Public License for more details.
//
//  You should have received a copy of the GNU General Public License
//  along with this program.  If not, see <http://www.gnu.org/licenses/>.
//----------------------------------------------------------------------------

#ifndef NJ_THREADS_SYSTEM_WIN_H
#	define NJ_THREADS_SYSTEM_WIN_H

#	include "NjExample01.h"

#	if defined(NJ_PLATFORM_WIN32) || defined(NJ_PLATFORM_WIN64)
#		include "NjThreadsSystem.h"

	/// \brief The default Windows implementation for NjThreadsSystem
	class NjThreadsSystemWin : public NjThreadsSystem::Implementation
	{
	public:
		NJ_TRIVIAL_DEFAULT_CONSTRUCTOR(NjThreadsSystemWin);
		NJ_TRIVIAL_VIRTUAL_DESTRUCTOR(NjThreadsSystemWin);

		/// \copydoc NjThreadsSystem::Thread
		typedef NjThreadsSystem::Thread Thread;

		/// \copydoc NjThreadsSystem::ThreadFunct
		typedef NjThreadsSystem::ThreadFunct ThreadFunct;

		/// \copydoc NjThreadsSystem::TryResult
		typedef NjThreadsSystem::TryResult TryResult;

		/// \copydoc NjThreadsSystem::TimeMs
		typedef NjThreadsSystem::TimeMs TimeMs;

		/// \copydoc NjThreadsSystem::YeldResult
		typedef NjThreadsSystem::YeldResult YeldResult;

		/// \copydoc NjThreadsSystem::CreateThread
		virtual Thread * CreateThread(ThreadFunct pfnThread, void * pData);

		/// \copydoc NjThreadsSystem::TryJoinThread
		virtual TryResult TryJoinThread(Thread * pThread, TimeMs uTimeMs);

		/// \copydoc NjThreadsSystem::DestroyThread
		virtual NjBool DestroyThread(Thread * pThread);

		/// \copydoc NjThreadsSystem::Sleep
		virtual NjBool Sleep(TimeMs uTimeMs);

		/// \copydoc NjThreadsSystem::Yeld
		virtual YeldResult Yeld();

	private:
		/// \brief Private class for internal use
		class Static;

		NJ_DISABLE_COPY(NjThreadsSystemWin);
	};

	/// \brief Default platform specific implementation of NjThreadsSystem
	typedef NjThreadsSystemWin NjThreadsSystemPlatform;
#	endif // defined(NJ_PLATFORM_WIN32) || defined(NJ_PLATFORM_WIN64)

#endif // NJ_THREADS_SYSTEM_WIN_H
